#pragma once

#include "mp3types.h"
#include "BitReserve.h"

typedef uint32 HUFFBITS;
const int HTN = 34;

struct huffcodetab
{
	char tablename[3];			// string, containing table_description
	uint32 xlen; 				// max. x-index+
	uint32 ylen;	            // max. y-index+
	uint32 linbits; 			// number of linbits
	uint32 linmax;				// max number to be stored in linbits
	int32 ref;					// a positive value indicates a reference
	HUFFBITS *table;			// pointer to array[xlen][ylen]
	unsigned char *hlen;		// pointer to array[xlen][ylen]
	unsigned char(*val)[2];		// decoder tree
	uint32 treelen;				// length of decoder tree
};

extern struct huffcodetab ht[HTN];

int32 huffman_decoder(huffcodetab *h,int32 *x,int32 *y,int32 *v,int32 *w,CBitReserve *br);
